﻿namespace WMS6.Web.Outbound
{
    using System;
    using System.Collections.Generic;
    using System.Data;
    using System.Web.UI;
    using System.Web.UI.HtmlControls;
    using System.Web.UI.WebControls;
    using WMS6.Web;
    using WMS6.Web.BaseInfoDetailServiceRef;
    using WMS6.Web.BaseInfoServiceRef;
    using WMS6.Web.OutboundService2Ref;
    using WMS6.Web.UserControls;

    public class WaveTemplate : BasePage
    {
        protected HtmlInputButton btnAction;
        protected Button btnCopy;
        protected Button btnDelete;
        protected Button btnGoBack;
        protected Button btnNew;
        protected Button btnSave;
        protected CheckBox CheckBox1;
        protected CheckBox CheckBox10;
        protected CheckBox CheckBox2;
        protected CheckBox CheckBox3;
        protected CheckBox CheckBox4;
        protected CheckBox CheckBox5;
        protected CheckBox CheckBox6;
        protected CheckBox CheckBox7;
        protected CheckBox CheckBox8;
        protected CheckBox CheckBox9;
        protected CheckBox chkIsActive;
        protected CheckBox chkIsActive0;
        protected CheckBox ckbMultiItemWave;
        protected CheckBox ckbSecKillWave;
        protected CheckBox ckbSingleItemWave;
        protected CheckBox ckbWaveGeneratedByCarrier;
        protected CheckBox ckbWaveGeneratedByCustomer;
        protected CheckBox ckbWaveGeneratedByOwner;
        protected CheckBox ckbWaveGeneratedByTransMode;
        protected DropDownList ddlDate;
        protected DropDownList ddlPriority;
        protected DropDownList ddlRunMode;
        protected DropDownList DropDownList1;
        protected HtmlForm F7026;
        protected GridView gvOrder;
        protected HtmlInputHidden hdnFrom;
        protected HtmlImage img3;
        protected Label Label1;
        protected Label Label2;
        protected Label Label3;
        protected Label Label4;
        protected Label Label5;
        protected Label Label6;
        protected Label lblCarrierExcludes;
        protected Label lblCarrierIncludes;
        protected Label lblCityExcludes;
        protected Label lblCityIncludes;
        protected Label lblCustomerExcludes;
        protected Label lblCustomerIncludes;
        protected Label lblDescr;
        protected Label lblDriverExcludes;
        protected Label lblDriverIncludes;
        protected Label lblMaxOrderLines;
        protected Label lblMaxOrders;
        protected Label lblMaxQty;
        protected Label lblMaxSkus;
        protected Label lblMaxVolume;
        protected Label lblMaxWeigth;
        protected Label lblMinOrderLines;
        protected Label lblMinOrders;
        protected Label lblMinQty;
        protected Label lblMinSkus;
        protected Label lblMinVolume;
        protected Label lblMinWeight;
        protected Label lblMsg;
        protected Label lblOrderQty;
        protected Label lblOrderStatusExcludes;
        protected Label lblOrderStatusIncludes;
        protected Label lblOrderTypeExcludes;
        protected Label lblOrderTypeIncludes;
        protected Label lblOwner;
        protected Label lblOwnerExcludes;
        protected Label lblOwnerIncludes;
        protected Label lblPriority;
        protected Label lblProvinceExcludes;
        protected Label lblProvinceIncludes;
        protected Label lblRouteExcludes;
        protected Label lblRouteIncludes;
        protected Label lblRunMode;
        protected Label lblSkuClassExcludes;
        protected Label lblSkuClassIncludes;
        protected Label lblSkuExcludes;
        protected Label lblSkuIncludes;
        protected Label lblSkuStyleExcludes;
        protected Label lblSkuStyleIncludes;
        protected Label lblTransModeExcludes;
        protected Label lblTransModeInclues;
        protected Label lblVehicleExcludes;
        protected Label lblVehicleIncludes;
        protected Label lblWaveFlow;
        protected Label lblWaveSelections;
        protected Label lblWaveTemplate;
        protected Label lblZoneExcludes;
        protected Label lblZoneIncludes;
        protected LinkButton lnkbtnCreateWave;
        protected LinkButton lnkbtnPreviewWave;
        protected MultipleSelectControl MSCCarrierExcludes;
        protected MultipleSelectControl MSCCarrierIncludes;
        protected MultipleSelectControl MSCCustomerExcludes;
        protected MultipleSelectControl MSCCustomerIncludes;
        protected MultipleSelectControl MSCOwnerExcludes;
        protected MultipleSelectControl MSCOwnerIncludes;
        protected MultipleSelectControl MSCSkuClassExcludes;
        protected MultipleSelectControl MSCSkuClassIncludes;
        protected HtmlLink mycss;
        protected Label one1;
        protected Label one2;
        protected HtmlTableCell tdlnkbtnCreateWave;
        protected HtmlTableCell tdlnkbtnPreviewWave;
        protected TextBox txtCityExcludes;
        protected TextBox txtCityIncludes;
        protected TextBox txtDaysAfter;
        protected TextBox txtDaysBefore;
        protected TextBox txtDescr;
        protected TextBox txtDriverExcludes;
        protected TextBox txtDriverIncludes;
        protected TextBox txtHoursAfter;
        protected TextBox txtHoursBefore;
        protected TextBox txtMaxOrderLines;
        protected TextBox txtMaxOrders;
        protected TextBox txtMaxQty;
        protected TextBox txtMaxSkus;
        protected TextBox txtMaxVolume;
        protected TextBox txtMaxWeigth;
        protected TextBox txtMinOrderLines;
        protected TextBox txtMinOrders;
        protected TextBox txtMinQty;
        protected TextBox txtMinSkus;
        protected TextBox txtMinutesAfter;
        protected TextBox txtMinutesBefore;
        protected TextBox txtMinVolume;
        protected TextBox txtMinWeight;
        protected TextBox txtOrderQty;
        protected TextBox txtOrderSatausExcludes;
        protected TextBox txtOrderStatusIncludes;
        protected TextBox txtOrderTypeExcludes;
        protected TextBox txtOrderTypeIncludes;
        protected TextBox txtProvinceExcludes;
        protected TextBox txtProvinceIncludes;
        protected TextBox txtRouteExcludes;
        protected TextBox txtRouteIncludes;
        protected TextBox txtSkuExcludes;
        protected TextBox txtSkuIncludes;
        protected TextBox txtSkuStyleExcludes;
        protected TextBox txtSkuStyleIncludes;
        protected TextBox txtTransModeExcludes;
        protected TextBox txtTransModeInclues;
        protected TextBox txtVehicleExcludes;
        protected TextBox txtVehicleIncludes;
        protected TextBox txtWaveFlow;
        protected TextBox txtWaveSelections;
        protected TextBox txtWaveTemplateID;
        protected TextBox txtZoneExcludes;
        protected TextBox txtZoneIncludes;

        protected void btnCopy_Click(object sender, EventArgs e)
        {
            this.txtWaveTemplateID.Text = "";
            this.txtWaveTemplateID.Enabled = true;
            base.DataEntityViewState = null;
        }

        protected void btnDelete_Click(object sender, EventArgs e)
        {
            try
            {
                string strTemp = string.Empty;
                strTemp = OutboundService2ClientProxy.GetInstance().DeleteWaveTemplate(new List<string> { this.txtWaveTemplateID.Text });
                this.lblMsg.Text = strTemp + "删除成功!";
                this.btnCopy.Enabled = false;
                this.btnDelete.Enabled = false;
                this.btnSave.Enabled = false;
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = "操作异常:" + ex.Message;
            }
        }

        protected void btnGoBack_Click(object sender, EventArgs e)
        {
            switch (this.hdnFrom.Value)
            {
                case "query":
                    base.Response.Redirect("WaveTemplateQuery.aspx", false);
                    break;

                case "list":
                    base.Response.Redirect("WaveTemplateList.aspx?from=edit", false);
                    break;
            }
        }

        protected void btnSave_Click(object sender, EventArgs e)
        {
            if (base.DataEntityViewState != null)
            {
                this.UpdateWaveTemplateInfo();
            }
            else
            {
                this.InsertWaveTemplateInfo();
            }
        }

        private WaveTemplateInfo GetWaveTemplateInfo()
        {
            WaveTemplateInfo WaveTemplateInfo = new WaveTemplateInfo();
            if (base.DataEntityViewState != null)
            {
                WaveTemplateInfo = base.DataEntityViewState as WaveTemplateInfo;
            }
            WaveTemplateInfo.WaveTemplateID = this.txtWaveTemplateID.Text;
            WaveTemplateInfo.Descr = this.txtDescr.Text;
            WaveTemplateInfo.IsActive = this.chkIsActive.Checked ? "Y" : "N";
            WaveTemplateInfo.Priority = this.ddlPriority.SelectedValue;
            WaveTemplateInfo.RunMode = this.ddlRunMode.SelectedValue;
            WaveTemplateInfo.WaveFlowID = this.txtWaveFlow.Text;
            WaveTemplateInfo.AutoRelease = "N";
            WaveTemplateInfo.MultiItemWave = this.ckbMultiItemWave.Checked ? "Y" : "N";
            WaveTemplateInfo.SecKillWave = this.ckbSecKillWave.Checked ? "Y" : "N";
            WaveTemplateInfo.SingleItemWave = this.ckbSingleItemWave.Checked ? "Y" : "N";
            WaveTemplateInfo.WaveGeneratedByCarrier = this.ckbWaveGeneratedByCarrier.Checked ? "Y" : "N";
            WaveTemplateInfo.WaveGeneratedByCustomer = this.ckbWaveGeneratedByCustomer.Checked ? "Y" : "N";
            WaveTemplateInfo.WaveGeneratedByOwner = this.ckbWaveGeneratedByOwner.Checked ? "Y" : "N";
            WaveTemplateInfo.WaveGeneratedByTransMode = this.ckbWaveGeneratedByTransMode.Checked ? "Y" : "N";
            if (!string.IsNullOrEmpty(this.txtOrderQty.Text))
            {
                WaveTemplateInfo.OrderQty = int.Parse(this.txtOrderQty.Text);
            }
            if (!string.IsNullOrEmpty(this.txtDaysAfter.Text))
            {
                WaveTemplateInfo.DaysAfter = int.Parse(this.txtDaysAfter.Text);
            }
            if (!string.IsNullOrEmpty(this.txtDaysBefore.Text))
            {
                WaveTemplateInfo.DaysBefore = int.Parse(this.txtDaysBefore.Text);
            }
            if (!string.IsNullOrEmpty(this.txtHoursBefore.Text))
            {
                WaveTemplateInfo.HoursBefore = int.Parse(this.txtHoursBefore.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinutesBefore.Text))
            {
                WaveTemplateInfo.MinutesBefore = int.Parse(this.txtMinutesBefore.Text);
            }
            if (!string.IsNullOrEmpty(this.txtHoursAfter.Text))
            {
                WaveTemplateInfo.HoursAfter = int.Parse(this.txtHoursAfter.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinutesAfter.Text))
            {
                WaveTemplateInfo.MinutesAfter = int.Parse(this.txtMinutesAfter.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinOrders.Text))
            {
                WaveTemplateInfo.MinOrders = int.Parse(this.txtMinOrders.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMaxOrders.Text))
            {
                WaveTemplateInfo.MaxOrders = int.Parse(this.txtMaxOrders.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinOrderLines.Text))
            {
                WaveTemplateInfo.MinOrderLines = int.Parse(this.txtMinOrderLines.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMaxOrderLines.Text))
            {
                WaveTemplateInfo.MaxOrderLines = int.Parse(this.txtMaxOrderLines.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinSkus.Text))
            {
                WaveTemplateInfo.MinSkus = int.Parse(this.txtMinSkus.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMaxSkus.Text))
            {
                WaveTemplateInfo.MaxSkus = int.Parse(this.txtMaxSkus.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinQty.Text))
            {
                WaveTemplateInfo.MinQty = int.Parse(this.txtMinQty.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMaxQty.Text))
            {
                WaveTemplateInfo.MaxQty = int.Parse(this.txtMaxQty.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinWeight.Text))
            {
                WaveTemplateInfo.MinWeight = int.Parse(this.txtMinWeight.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMaxWeigth.Text))
            {
                WaveTemplateInfo.MaxWeight = int.Parse(this.txtMaxWeigth.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMinVolume.Text))
            {
                WaveTemplateInfo.MinVolume = int.Parse(this.txtMinVolume.Text);
            }
            if (!string.IsNullOrEmpty(this.txtMaxVolume.Text))
            {
                WaveTemplateInfo.MaxVolume = int.Parse(this.txtMaxVolume.Text);
            }
            WaveTemplateInfo.CarrierIncludes = this.MSCCarrierIncludes.ReturnValue;
            WaveTemplateInfo.CarrierExcludes = this.MSCCarrierExcludes.ReturnValue;
            WaveTemplateInfo.OwnerExcludes = this.MSCOwnerExcludes.ReturnValue;
            WaveTemplateInfo.OwnerIncludes = this.MSCOwnerIncludes.ReturnValue;
            WaveTemplateInfo.CustomerExcludes = this.MSCCustomerExcludes.ReturnValue;
            WaveTemplateInfo.CustomerIncludes = this.MSCCustomerIncludes.ReturnValue;
            WaveTemplateInfo.CityExcludes = this.txtCityExcludes.Text;
            WaveTemplateInfo.CityIncludes = this.txtCityIncludes.Text;
            WaveTemplateInfo.DriverExcludes = this.txtDriverExcludes.Text;
            WaveTemplateInfo.DriverIncludes = this.txtDriverIncludes.Text;
            WaveTemplateInfo.RouteExcludes = this.txtRouteExcludes.Text;
            WaveTemplateInfo.RouteIncludes = this.txtRouteIncludes.Text;
            WaveTemplateInfo.ProvinceExcludes = this.txtProvinceExcludes.Text;
            WaveTemplateInfo.ProvinceIncludes = this.txtProvinceIncludes.Text;
            WaveTemplateInfo.SkuClassExcludes = this.MSCSkuClassExcludes.ReturnValue;
            WaveTemplateInfo.SkuClassIncludes = this.MSCSkuClassIncludes.ReturnValue;
            WaveTemplateInfo.SkuExcludes = this.txtSkuExcludes.Text;
            WaveTemplateInfo.SkuIncludes = this.txtSkuIncludes.Text;
            WaveTemplateInfo.SkuStyleExcludes = this.txtSkuStyleExcludes.Text;
            WaveTemplateInfo.SkuStyleIncludes = this.txtSkuStyleIncludes.Text;
            WaveTemplateInfo.TransModeExcludes = this.txtTransModeExcludes.Text;
            WaveTemplateInfo.TransModeIncludes = this.txtTransModeInclues.Text;
            WaveTemplateInfo.VehicleExcludes = this.txtVehicleExcludes.Text;
            WaveTemplateInfo.VehicleIncludes = this.txtVehicleIncludes.Text;
            WaveTemplateInfo.WaveSelection = this.txtWaveSelections.Text;
            WaveTemplateInfo.ZoneExcludes = this.txtZoneExcludes.Text;
            WaveTemplateInfo.ZoneIncludes = this.txtZoneIncludes.Text;
            return WaveTemplateInfo;
        }

        protected void gvOrder_RowDataBound(object sender, GridViewRowEventArgs e)
        {
            if (e.Row.RowType == DataControlRowType.DataRow)
            {
                e.Row.Cells[0].Text = (e.Row.RowIndex + 1).ToString();
                e.Row.Attributes.Add("onmouseout", "GridViewRowMouseout(this);");
                e.Row.Attributes.Add("onmouseover", "GridViewRowMouseover(this);");
            }
        }

        private void InsertWaveTemplateInfo()
        {
            try
            {
                string strTemp = string.Empty;
                WaveTemplateInfo waveTemplateInfo = this.GetWaveTemplateInfo();
                waveTemplateInfo.CreatedBy = base.UserInfo.UserID;
                strTemp = OutboundService2ClientProxy.GetInstance().InsertWaveTemplate(waveTemplateInfo);
                this.txtWaveTemplateID.Text = strTemp;
                this.lblMsg.Text = strTemp + "新增成功！";
                this.txtWaveTemplateID.Enabled = false;
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("C005") + ex.Message;
            }
        }

        protected void lnkbtnCreateWave_Click(object sender, EventArgs e)
        {
            string temp = string.Empty;
            if (string.IsNullOrEmpty(this.txtWaveTemplateID.Text))
            {
                this.lblMsg.Text = "波次模板代码为空,无法生成!";
            }
            else
            {
                SysSettingInfo sysSetting = BaseInfoServiceClientProxy.GetInstance().GetInfoByID("WaveTemplateAjax", "SYS_SETTING") as SysSettingInfo;
                if ((sysSetting != null) && (sysSetting.Value == "Y"))
                {
                    ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "<script language='javascript'>CreateAjaxWaveTemplate();</script>", false);
                }
                else
                {
                    try
                    {
                        temp = OutboundService2ClientProxy.GetInstance().CreatedWaveByWaveTemplate(this.txtWaveTemplateID.Text);
                        this.lblMsg.Text = "波次单" + temp + "生成成功!";
                    }
                    catch (Exception ex)
                    {
                        this.lblMsg.Text = ex.Message;
                    }
                }
            }
        }

        protected void lnkbtnPreviewWave_Click(object sender, EventArgs e)
        {
            if (!string.IsNullOrEmpty(this.txtWaveTemplateID.Text))
            {
                List<OrderDetailInfo> orderList = OutboundService2ClientProxy.GetInstance().PreviewWaveByWaveTemplate(this.txtWaveTemplateID.Text);
                if (orderList != null)
                {
                    base.BindData2GridView(this.gvOrder, orderList);
                }
                ScriptManager.RegisterStartupScript(this.Page, base.GetType(), "", "<script language='javascript'>setTab('one',2,2);</script>", false);
            }
            else
            {
                this.lblMsg.Text = "波次模板代码为空无法进行预览!";
            }
        }

        private void LoadData()
        {
            base.BindData2DDLBySysCode(this.ddlPriority, "TaskPriority");
            this.ddlPriority.SelectedValue = "5";
            base.BindData2DDLBySysCode(this.ddlRunMode, "RunMode");
            this.ddlRunMode.SelectedValue = "Manual";
            this.ddlRunMode.Enabled = false;
            if (!string.IsNullOrEmpty(base.Request.QueryString["ID"]))
            {
                this.SetWaveTemplateInfo2Form();
            }
            if (!string.IsNullOrEmpty(base.Request.QueryString["from"]))
            {
                this.hdnFrom.Value = base.Request.QueryString["from"].ToString();
            }
        }

        private void LoadMultipleSelectControl()
        {
            TradePartnerQueryEntity tradePartnerQuery = new TradePartnerQueryEntity {
                Type = "1",
                IsGetAll = true
            };
            DataSet ds = new DataSet();
            ds = BaseInfoServiceClientProxy.GetInstance().GetInfoByQueryEntity(tradePartnerQuery, "TRADE_PARTNER");
            this.MSCOwnerExcludes.DataTextField = "OWNER_ID";
            this.MSCOwnerExcludes.DataValueField = "OWNER_ID";
            this.MSCOwnerExcludes.DataSetSource = ds;
            this.MSCOwnerIncludes.DataTextField = "OWNER_ID";
            this.MSCOwnerIncludes.DataValueField = "OWNER_ID";
            this.MSCOwnerIncludes.DataSetSource = ds;
            ds = null;
            CustomerQueryEntity customerQuery = new CustomerQueryEntity {
                IsGetAll = true
            };
            ds = BaseInfoServiceClientProxy.GetInstance().GetInfoByQueryEntity(customerQuery, "CUSTOMER");
            this.MSCCustomerIncludes.DataTextField = "CUSTOMER_ID";
            this.MSCCustomerIncludes.DataValueField = "CUSTOMER_ID";
            this.MSCCustomerIncludes.DataSetSource = ds;
            this.MSCCustomerExcludes.DataTextField = "CUSTOMER_ID";
            this.MSCCustomerExcludes.DataValueField = "CUSTOMER_ID";
            this.MSCCustomerExcludes.DataSetSource = ds;
            ds = null;
            CarrierQueryEntity carrierQuery = new CarrierQueryEntity {
                IsGetAll = true
            };
            ds = BaseInfoServiceClientProxy.GetInstance().GetInfoByQueryEntity(carrierQuery, "CARRIER");
            this.MSCCarrierIncludes.DataTextField = "CARRIER_ID";
            this.MSCCarrierIncludes.DataValueField = "CARRIER_ID";
            this.MSCCarrierIncludes.DataSetSource = ds;
            this.MSCCarrierExcludes.DataTextField = "CARRIER_ID";
            this.MSCCarrierExcludes.DataValueField = "CARRIER_ID";
            this.MSCCarrierExcludes.DataSetSource = ds;
            ds = null;
            SkuClassQueryEntity skuClassQuery = new SkuClassQueryEntity {
                IsGetAll = true
            };
            ds = BaseInfoDetailServiceClientProxy.GetInstance().GetDetaiInfolByQueryEntity(skuClassQuery, "SKU_CLASS");
            this.MSCSkuClassExcludes.DataTextField = "SKU_CLASS_ID";
            this.MSCSkuClassExcludes.DataValueField = "SKU_CLASS_ID";
            this.MSCSkuClassExcludes.DataSetSource = ds;
            this.MSCSkuClassIncludes.DataTextField = "SKU_CLASS_ID";
            this.MSCSkuClassIncludes.DataValueField = "SKU_CLASS_ID";
            this.MSCSkuClassIncludes.DataSetSource = ds;
            ds = null;
        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!base.IsPostBack)
            {
                base.InitPage(this.Page);
                this.LoadData();
                this.LoadMultipleSelectControl();
            }
        }

        private void SetWaveTemplateInfo2Form()
        {
            try
            {
                string waveTemplateID = base.Request.QueryString["ID"].ToString();
                WaveTemplateInfo WaveTemplateInfo = OutboundService2ClientProxy.GetInstance().GetWaveTemplateByID(waveTemplateID);
                if (WaveTemplateInfo != null)
                {
                    base.DataEntityViewState = WaveTemplateInfo;
                    this.txtWaveTemplateID.Text = WaveTemplateInfo.WaveTemplateID;
                    this.txtWaveTemplateID.Enabled = false;
                    this.ddlPriority.SelectedValue = WaveTemplateInfo.Priority;
                    this.ddlRunMode.SelectedValue = WaveTemplateInfo.RunMode;
                    this.txtWaveFlow.Text = WaveTemplateInfo.WaveFlowID;
                    this.txtDescr.Text = WaveTemplateInfo.Descr;
                    this.chkIsActive.Checked = WaveTemplateInfo.IsActive == "Y";
                    this.ckbMultiItemWave.Checked = WaveTemplateInfo.MultiItemWave == "Y";
                    this.ckbSecKillWave.Checked = WaveTemplateInfo.SecKillWave == "Y";
                    this.ckbSingleItemWave.Checked = WaveTemplateInfo.SingleItemWave == "Y";
                    this.ckbWaveGeneratedByCarrier.Checked = WaveTemplateInfo.WaveGeneratedByCarrier == "Y";
                    this.ckbWaveGeneratedByCustomer.Checked = WaveTemplateInfo.WaveGeneratedByCustomer == "Y";
                    this.ckbWaveGeneratedByOwner.Checked = WaveTemplateInfo.WaveGeneratedByOwner == "Y";
                    this.ckbWaveGeneratedByTransMode.Checked = WaveTemplateInfo.WaveGeneratedByTransMode == "Y";
                    this.txtOrderQty.Text = WaveTemplateInfo.OrderQty.ToString();
                    this.txtDaysAfter.Text = WaveTemplateInfo.DaysAfter.ToString();
                    this.txtDaysBefore.Text = WaveTemplateInfo.DaysBefore.ToString();
                    this.txtHoursBefore.Text = WaveTemplateInfo.HoursBefore.ToString();
                    this.txtMinutesBefore.Text = WaveTemplateInfo.MinutesBefore.ToString();
                    this.txtHoursAfter.Text = WaveTemplateInfo.HoursAfter.ToString();
                    this.txtMinutesAfter.Text = WaveTemplateInfo.MinutesAfter.ToString();
                    this.txtMinOrders.Text = WaveTemplateInfo.MinOrders.ToString();
                    this.txtMaxOrders.Text = WaveTemplateInfo.MaxOrders.ToString();
                    this.txtMinOrderLines.Text = WaveTemplateInfo.MinOrderLines.ToString();
                    this.txtMaxOrderLines.Text = WaveTemplateInfo.MaxOrderLines.ToString();
                    this.txtMinSkus.Text = WaveTemplateInfo.MinSkus.ToString();
                    this.txtMaxSkus.Text = WaveTemplateInfo.MaxSkus.ToString();
                    this.txtMinQty.Text = WaveTemplateInfo.MinQty.ToString();
                    this.txtMaxQty.Text = WaveTemplateInfo.MaxQty.ToString();
                    this.txtMinWeight.Text = WaveTemplateInfo.MinWeight.ToString();
                    this.txtMaxWeigth.Text = WaveTemplateInfo.MaxWeight.ToString();
                    this.txtMinVolume.Text = WaveTemplateInfo.MinVolume.ToString();
                    this.txtMaxVolume.Text = WaveTemplateInfo.MaxVolume.ToString();
                    this.MSCCarrierIncludes.DefaultSelected = WaveTemplateInfo.CarrierIncludes;
                    this.MSCCarrierExcludes.DefaultSelected = WaveTemplateInfo.CarrierExcludes;
                    this.MSCOwnerExcludes.DefaultSelected = WaveTemplateInfo.OwnerExcludes;
                    this.MSCOwnerIncludes.DefaultSelected = WaveTemplateInfo.OwnerIncludes;
                    this.MSCCustomerExcludes.DefaultSelected = WaveTemplateInfo.CustomerExcludes;
                    this.MSCCustomerIncludes.DefaultSelected = WaveTemplateInfo.CustomerIncludes;
                    this.txtCityExcludes.Text = WaveTemplateInfo.CityExcludes;
                    this.txtCityIncludes.Text = WaveTemplateInfo.CityIncludes;
                    this.txtDriverExcludes.Text = WaveTemplateInfo.DriverExcludes;
                    this.txtDriverIncludes.Text = WaveTemplateInfo.CarrierIncludes;
                    this.txtRouteExcludes.Text = WaveTemplateInfo.RouteExcludes;
                    this.txtRouteIncludes.Text = WaveTemplateInfo.RouteIncludes;
                    this.txtProvinceExcludes.Text = WaveTemplateInfo.ProvinceExcludes;
                    this.txtProvinceIncludes.Text = WaveTemplateInfo.ProvinceIncludes;
                    this.MSCSkuClassExcludes.DefaultSelected = WaveTemplateInfo.SkuClassExcludes;
                    this.MSCSkuClassIncludes.DefaultSelected = WaveTemplateInfo.SkuClassIncludes;
                    this.txtSkuExcludes.Text = WaveTemplateInfo.SkuExcludes;
                    this.txtSkuIncludes.Text = WaveTemplateInfo.SkuIncludes;
                    this.txtSkuStyleExcludes.Text = WaveTemplateInfo.SkuStyleExcludes;
                    this.txtSkuStyleIncludes.Text = WaveTemplateInfo.SkuStyleIncludes;
                    this.txtTransModeExcludes.Text = WaveTemplateInfo.TransModeExcludes;
                    this.txtTransModeInclues.Text = WaveTemplateInfo.TransModeIncludes;
                    this.txtVehicleExcludes.Text = WaveTemplateInfo.VehicleExcludes;
                    this.txtVehicleIncludes.Text = WaveTemplateInfo.VehicleIncludes;
                    this.txtWaveSelections.Text = WaveTemplateInfo.WaveSelection;
                    this.txtZoneExcludes.Text = WaveTemplateInfo.ZoneExcludes;
                    this.txtZoneIncludes.Text = WaveTemplateInfo.ZoneIncludes;
                }
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = ex.Message;
            }
        }

        private void UpdateWaveTemplateInfo()
        {
            try
            {
                string strTemp = string.Empty;
                WaveTemplateInfo waveTemplateInfo = this.GetWaveTemplateInfo();
                waveTemplateInfo.UpdatedBy = base.UserInfo.UserID;
                strTemp = OutboundService2ClientProxy.GetInstance().UpdateWaveTemplate(waveTemplateInfo);
                this.lblMsg.Text = strTemp + "更新成功！";
            }
            catch (Exception ex)
            {
                this.lblMsg.Text = base.GetGlobalMsgResource("C003") + ex.Message;
            }
        }
    }
}

